diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-10-31 20:31:03 +0100 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-10-31 20:31:03 +0100 |
commit | 06a8ed945b4c517bb6cf5c84f0d06aa9ede37f11 (patch) | |
tree | 38cf7445bc01a42437f1329d74652865debc86ea /web/pw-server/src/routes/bots/[bot_name]/stats.svelte | |
parent | 8d556bbff1bd716c2c42c8002706038f28b55b91 (diff) | |
download | planetwars.dev-06a8ed945b4c517bb6cf5c84f0d06aa9ede37f11.tar.xz planetwars.dev-06a8ed945b4c517bb6cf5c84f0d06aa9ede37f11.zip |
tabbed bot page
Diffstat (limited to 'web/pw-server/src/routes/bots/[bot_name]/stats.svelte')
-rw-r--r-- | web/pw-server/src/routes/bots/[bot_name]/stats.svelte | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/web/pw-server/src/routes/bots/[bot_name]/stats.svelte b/web/pw-server/src/routes/bots/[bot_name]/stats.svelte index 6b5a2e1..67b769f 100644 --- a/web/pw-server/src/routes/bots/[bot_name]/stats.svelte +++ b/web/pw-server/src/routes/bots/[bot_name]/stats.svelte @@ -12,11 +12,10 @@ apiClient.get("/api/leaderboard"), ]); - const { bot, owner } = botData; + const { bot } = botData; return { props: { bot, - owner, botStats, leaderboard, }, @@ -29,7 +28,7 @@ } } - function mergedStats(rawStats: object) { + function calcMergedStats(rawStats: object) { return Object.fromEntries( Object.entries(rawStats).map(([opponent, ms]) => { const mapStats = ms as { k: MatchupStats }; @@ -59,23 +58,13 @@ <script lang="ts"> export let bot: object; - export let owner: object; export let botStats: object; export let leaderboard: object[]; - $: mergedStats = mergedStats(botStats); + $: mergedStats = calcMergedStats(botStats); </script> <div class="container"> - <div class="header"> - <h1 class="bot-name">{bot["name"]}</h1> - {#if owner} - <a class="owner-name" href="/users/{owner['username']}"> - {owner["username"]} - </a> - {/if} - </div> - <h2>Stats</h2> <table class="leaderboard"> <tr class="leaderboard-row leaderboard-header"> <th class="leaderboard-rank">Rank</th> |